package sample.test.cc.cool.gui.util;

import javax.swing.InputVerifier;
import javax.swing.JComponent;
import javax.swing.JTextField;

public class IntegerValidator extends InputVerifier {

	private static final long serialVersionUID = 7870433406128280382L;

	@Override
	public boolean verify(JComponent input) {
		JTextField tf = (JTextField) input;
		try {
			Integer.parseInt(tf.getText());
		} catch (NumberFormatException e) {
			return false;
		}
		return true;
	}

}
